<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <h1>Extends Optin Demo</h1>
    <hr />
    <div id="app">
      {{message}}
      <p><button @click="add">add</button></p>
    </div>
    <script type="text/javascript">
      var extendsObj = {
        created: function () {
          console.log("我是被扩展出来的");
        },
        methods: {
          add: function () {
            console.log("我是被扩展出来的方法ADD");
          },
        },
      };

      var app = new Vue({
        el: "#app",
        data: {
          message: "hello Vue!",
        },
        methods: {
          add: function () {
            console.log("我是原生方法ADD");
          },
        },
        created: function () {
          console.log("我是原生的");
        },
        extends: extendsObj,
        // delimiters: ["${", "}"],  {{message}} 这样的取值就不能用了，需要使用${message} 才能取值
      });
    </script>
  </body>
</html>
